//
//  ScrollPhotoView+AddopenView.m
//  NaRiLSVMT
//
//  Created by zhangmeng on 14-8-19.
//  Copyright (c) 2014年 helloyouth.org. All rights reserved.
//

#import "ScrollPhotoView+AddopenView.h"
#import "ScrollPhotoView+Request.h"
#import "ScreenPreviewView.h"
@implementation ScrollPhotoView (AddopenView)
-(void)openThumbView
{
    CGRect tmpr = self.collecView.view.frame;
    tmpr.origin.y = 12;
    self.collecView.view.frame = tmpr;
    ((ScreenPreviewView *)self.superview).allbtn.hidden  = YES;//[self.superview bringSubviewToFront:self.collView];
     NSArray *tmparr = self.nowPlaydata[StringFromInt(self.nowScreen)];
     MJCollectionViewController *collecView = self.nowPlaydata[@"collec"];
    [UIView animateWithDuration:0.3
                          delay:0.0
                        options:UIViewAnimationOptionCurveLinear
                     animations:^{
                         CGRect tr = self.switchView.frame;
                         tr.origin.y = 160;
                         self.switchView.frame = tr;
                         
                         tr = self.collView.frame;
                         tr.origin.y = 203;
                         tr.size.height = 375;
                         self.collView.frame = tr;
                         
                         collecView.num = 8;
                         //判断展开在第几页
                         if(collecView.pageBtnnum<=2){
                             collecView.pageBtnnum = 1;
                         }
                         
                         else
                         {
                         if(collecView.pageBtnnum%2 == 0){
                             collecView.pageBtnnum  = collecView.pageBtnnum / 2;
                         }
                         else{
                             collecView.pageBtnnum  = collecView.pageBtnnum / 2 + 1;
                         }
                         }
                         
                         if(collecView.clickNum >= CLOSEPAGE){
                             if(collecView.clickNum%8 >= 4){
                                 collecView.pagenum = (collecView.pageBtnnum-1)*8;
                             }
                             else{
                                 collecView.pagenum = (collecView.pageBtnnum-1)*8;
                             }
                         }
                         else{
                             collecView.pagenum = (collecView.pageBtnnum-1)*8;
                         }
                         
                         if(collecView.allPage/collecView.num)
                             collecView.allPagenumber  = collecView.allPage/collecView.num +1 ;
                         else
                             collecView.allPagenumber  = collecView.allPage/collecView.num;
                         self.pageView.numberOfPages = collecView.allPagenumber;
                         self.pageView.currentPage = collecView.pageBtnnum - 1;
                         // self.collecView.pagenum = (self.collecView.pageBtnnum-1)*8;
                        [collecView.collectionView reloadData];
                         CGRect r;
                         r = self.proBtn.frame;
                         r.origin.y = 111;
                         self.proBtn.frame = r;
                         
                         r = self.nextBtn.frame;
                         r.origin.y = 111;
                         self.nextBtn.frame = r;
                         r = self.listView.frame;
                         r.origin.y = 200;
                         self.listView.frame = r;
                     }
                     completion:^(BOOL finished) {
                     }];
    self.openroclose = YES;
    self.opencimageView.image = [UIImage imageNamed:@"scan_closethumb.png"];
    self.allthumb.hidden = NO;
    [self eventNumData:collecView.figureNum AllNUm:[tmparr count]];
    self.ocflag = OpenScreen;
}
-(void)closeThumbView
{
    CGRect tmpr;
  
    tmpr = self.collecView.view.frame;
    tmpr.origin.y = -8;
    self.collecView.view.frame = tmpr;
    MJCollectionViewController *collecView = self.nowPlaydata[@"collec"];
    [UIView animateWithDuration:0.3
                          delay:0.0
                        options:UIViewAnimationOptionCurveLinear
                     animations:^{
                         CGRect tr = self.switchView.frame;
                         tr.origin.y = 360;
                         self.switchView.frame = tr;
                         
                         tr = self.collView.frame;
                         tr.origin.y = 403;
                         tr.size.height = 175;
                         self.collView.frame = tr;
                         collecView.num = CLOSEPAGE;
                        //在点击的界面
                         
                         if(collecView.clickNum >= collecView.pagenum && collecView.clickNum < (collecView.pagenum+OPENPAGE)){
                             if(collecView.clickNum < (collecView.pagenum+CLOSEPAGE)){
                                 collecView.pageBtnnum  = collecView.pageBtnnum * 2 -1;
                                 //collecView.pagenum = (collecView.pageBtnnum-2)*CLOSEPAGE;
                             }
                             else{
                                 collecView.pageBtnnum  = collecView.pageBtnnum * 2;
                             }
                         }
                         
                         else{
                             if((collecView.allPage - collecView.pagenum-1) >= CLOSEPAGE ){
                                 collecView.pageBtnnum  = collecView.pageBtnnum * 2;
                             }
                             else{
                                 collecView.pageBtnnum  = collecView.pageBtnnum * 2 -1;
                             }
                         }
                         if(collecView.clickNum >= CLOSEPAGE){
                             if(collecView.clickNum%OPENPAGE >= CLOSEPAGE){
                                 collecView.pagenum = (collecView.pageBtnnum-1)*CLOSEPAGE;
                             }
                             else{
                                 collecView.pagenum = (collecView.pageBtnnum-1)*CLOSEPAGE;
                             }
                         }
                         else{
                             collecView.pagenum = (collecView.pageBtnnum-1)*CLOSEPAGE;
                         }
                         if(collecView.allPage/collecView.num)
                             collecView.allPagenumber  = collecView.allPage/collecView.num +1 ;
                         else
                             collecView.allPagenumber  = collecView.allPage/collecView.num;
                         
                         self.pageView.numberOfPages = collecView.allPagenumber;
                         self.pageView.currentPage = collecView.pageBtnnum - 1;
                         [collecView.collectionView reloadData];
                         CGRect r;
                         r = self.proBtn.frame;
                         r.origin.y = 0;
                         self.proBtn.frame = r;
                         r = self.nextBtn.frame;
                         r.origin.y = 0;
                         self.nextBtn.frame = r;
                         r = self.listView.frame;
                         r.origin.y = 400;
                         self.listView.frame = r;
                         
                     }
                     completion:^(BOOL finished) {
                     }];
      ((ScreenPreviewView *)self.superview).allbtn.hidden  = NO;
    self.opencimageView.image = [UIImage imageNamed:@"scan_openthumb.png"];
    self.openroclose = NO;
    self.allthumb.hidden = NO;
    self.ocflag = CloseScreen;
}
-(void)openThumbUi
{
    NSArray *tmparr = self.nowPlaydata[StringFromInt(self.nowScreen)];
    CGRect tr = self.switchView.frame;
    tr.origin.y = 160;
    self.switchView.frame = tr;
    
    tr = self.collView.frame;
    tr.origin.y = 203;
    tr.size.height = 375;
    self.collView.frame = tr;
    tr = self.collecView.view.frame;
    tr.origin.y = 12;
    self.collecView.view.frame = tr;
    
    CGRect r;
    r = self.proBtn.frame;
    r.origin.y = 111;
    self.proBtn.frame = r;
    
    r = self.nextBtn.frame;
    r.origin.y = 111;
    self.nextBtn.frame = r;
    self.openroclose = YES;
    self.opencimageView.image = [UIImage imageNamed:@"scan_closethumb.png"];
    self.allthumb.hidden = NO;
    [self eventNumData:self.collecView.figureNum AllNUm:[tmparr count]];
    self.ocflag = OpenScreen;


}
-(void)closeThumbUi
{
    CGRect tr = self.switchView.frame;
    tr.origin.y  = 360;
    self.switchView.frame = tr;
    
    tr = self.collView.frame;
    tr.origin.y = 403;
    tr.size.height = 175;
    self.collView.frame = tr;
    tr = self.collecView.view.frame;
    tr.origin.y = -8;
    self.collecView.view.frame = tr;
    CGRect r;
    r = self.proBtn.frame;
    r.origin.y = 0;
    self.proBtn.frame = r;
    r = self.nextBtn.frame;
    r.origin.y = 0;
    self.nextBtn.frame = r;
    self.opencimageView.image = [UIImage imageNamed:@"scan_openthumb.png"];
    self.openroclose = NO;
    self.allthumb.hidden = NO;
    self.ocflag = CloseScreen;

}
-(void)proBtnpage
{
    MJCollectionViewController *collecView = self.nowPlaydata[@"collec"];
    if(collecView.pagenum == 0){
        if(collecView.num == CLOSEPAGE){
            if([self.nowPlaydata[StringFromInt(self.nowScreen)] count]%CLOSEPAGE >0){
                collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - [self.nowPlaydata[StringFromInt(self.nowScreen)] count]%CLOSEPAGE;
            }
            else{
                collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - CLOSEPAGE;
            }
            collecView.pageBtnnum = collecView.pagenum/CLOSEPAGE+1;
        }
        else{
           // if(collecView.pagenum == 0){
            if([self.nowPlaydata[StringFromInt(self.nowScreen)] count]%OPENPAGE >0){
                collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - [self.nowPlaydata[StringFromInt(self.nowScreen)] count]%OPENPAGE;
            }
            else{
                collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - OPENPAGE;
            }
            collecView.pageBtnnum = collecView.pagenum/OPENPAGE+1;
            // collecView.clickNum = collecView.pagenum;
        }
        [collecView.collectionView reloadData];
       // collecView.clickNum = [self.nowPlaydata[self.nowScreen] count]-1;
        self.pageView.currentPage = collecView.pageBtnnum - 1;
        return;
    }
    
    if(collecView.pagenum > 0){
        collecView.pageBtnnum--;
        if(collecView.num == CLOSEPAGE){
            collecView.pagenum = collecView.pagenum - CLOSEPAGE;
            [collecView.collectionView reloadData];
        }
        else if(collecView.num == OPENPAGE){
            collecView.pagenum = collecView.pagenum - OPENPAGE;
            [collecView.collectionView reloadData];
        }
    }
        self.pageView.currentPage = collecView.pageBtnnum - 1;
}
-(void)nextBtnpage
{
    MJCollectionViewController *collecView = self.nowPlaydata[@"collec"];
    //最后一个跳到第一个
   // if(collecView.clickNum == [self.nowPlaydata[self.nowScreen] count]-1){
    if(collecView.allPage <= collecView.num)
        return;
    if(collecView.allPage <= collecView.pageBtnnum * collecView.num){
        collecView.clickNum = 0;
        collecView.pagenum = 0;
        collecView.pageBtnnum = 1;
        [collecView.collectionView reloadData];
        self.pageView.currentPage = collecView.pageBtnnum - 1;
        return;
    }
    
    if(collecView.allPage > collecView.pageBtnnum * collecView.num){
        collecView.pageBtnnum++;
        if(collecView.num == CLOSEPAGE){
            collecView.pagenum = collecView.pagenum+CLOSEPAGE;
            [collecView.collectionView reloadData];
        }
        else if(collecView.num == OPENPAGE){
            collecView.pagenum = collecView.pagenum+OPENPAGE;
            [collecView.collectionView reloadData];
        }
    }
     self.pageView.currentPage = collecView.pageBtnnum - 1;
}
-(void)proPlaypage:(MJCollectionViewController *)collecView
{
    if(collecView.pagenum > 0){
        collecView.pageBtnnum--;
        if(collecView.num == CLOSEPAGE){
            collecView.pagenum = collecView.pagenum - CLOSEPAGE;
            [collecView.collectionView reloadData];
        }
        else if(collecView.num == OPENPAGE){
            collecView.pagenum = collecView.pagenum - OPENPAGE;
            [collecView.collectionView reloadData];
        }
    }
     self.pageView.currentPage = collecView.pageBtnnum - 1;
}
-(void)nextPlaypage:(MJCollectionViewController *)collecView
{
    if(collecView.allPage > collecView.pageBtnnum * collecView.num){
        collecView.pageBtnnum++;
        if(collecView.num == CLOSEPAGE){
            collecView.pagenum = collecView.pagenum+CLOSEPAGE;
            [collecView.collectionView reloadData];
        }
        else if(collecView.num == OPENPAGE){
            collecView.pagenum = collecView.pagenum+OPENPAGE;
            [collecView.collectionView reloadData];
        }
    }
     self.pageView.currentPage = collecView.pageBtnnum-1;
}
//同步后台切屏数据
-(void)upateClient:(NSString *)screenId HostId:(NSString *)uphostId{
  //  int i = 0,
   // __block j = 0;
    for (NSMutableDictionary *dic in self.thumbScreen) {
        if([StringFromId(dic[@"screenId"]) isEqualToString:StringFromId(screenId)]){
           // NSArray *arr1 = dic.allKeys;
            NSArray *arr = dic[dic[@"numscreen"]];
            NSMutableArray *tmparr = [NSMutableArray array];
            //NSMutableDictionary *tmpdic = [NSMutableDictionary dictionary];
                [arr enumerateObjectsUsingBlock:^(NSDictionary *tmpdic, NSUInteger idx, BOOL *stop) {
                    NSMutableDictionary *tmpd = [NSMutableDictionary dictionaryWithDictionary:tmpdic];
                    BOOL isExits = NO;
                    NSArray *arr = [StringFromId(tmpdic[@"hostId"]) componentsSeparatedByString:@","];
                    for(NSString *host in arr){
                        if([host intValue] == [uphostId intValue]){
                            isExits = YES;
                            self.proHostArr = [NSMutableArray arrayWithArray:arr];
                            break;
                        }
                    }
                    if(isExits){
                       tmpd[@"showed"] = @1;
                     //  self.proHostId = [uphostId intValue];
                       // [tmpdic set];
                        //[tmpdic setObject:@1 forKey:@"showed"];
                        //索引到投平的缩略图
                        //[self switchPageClick:[dic.allKeys[0] intValue] NumHost:j Numbtn:i];
                    }
                    else{
                       // [tmpdic setValue:@0 forKey:@"showed"];
                        tmpd[@"showed"] = @0;
                    }
                    [tmparr addObject:tmpd];
            
                     //j++;
                    }];
          dic[dic[@"numscreen"]] = [NSArray arrayWithArray:tmparr];
//            if(self.thumbScreen[i])
//              [self getScreenImage:self.screenArr[0][@"id"] Numscreen:0];
          MJCollectionViewController *collection = dic[@"collec"];
          [collection counstView:tmparr];
            collection.flagplay = NO;
          [collection.collectionView reloadData];
          dic[@"noOnceplay"] = @0;
          dic[@"noArrowplay"] = @0;
          dic[@"startqueue"] = @"0";
          self.forScreen = NO;
        }
      //  i++;
    }
}
//画面播放器的开关  数据更新
-(void)deviceGetscreendata:(NSString *)screenId Group:(NSString *)groupId
{
    
    for (NSMutableDictionary *dic in self.thumbScreen) {
        if([StringFromId(dic[@"screenId"]) isEqualToString:StringFromId(screenId)]){
            NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:self.thumbScreen[self.nowScreen]];
            NSMutableArray *arr = [NSMutableArray arrayWithArray:dic[@"group"]];
            [arr removeObjectAtIndex:0];
            if(![dic[@"groupNum"] intValue]){
            [self updateScreenDate:screenId ScreenDic:dic Grouparr:arr];
            }
            else{
            NSDictionary *tmpiddic = arr[[dic[@"groupNum"] intValue] -1];
            if([groupId isEqualToString:tmpiddic[@"id"]]){
            if(![Common isEmptyString:groupId]){
            [self updateScreenDate:screenId ScreenDic:dic Grouparr:@[groupId]];
            }
            else{
            [self updateScreenDate:screenId ScreenDic:dic Grouparr:arr];
            }
            }
            }
        }
    }
}
-(void)eventNumData:(NSInteger)figure AllNUm:(NSInteger)allThumb
{
    dispatch_async(dispatch_get_main_queue(), ^{
    self.allthumb.text = [NSString stringWithFormat:@"%@ %ld / %@%ld%@",@"当前投屏:",figure+1,@"共",(long)allThumb,@"画面"];
       });
}
- (void)slideOutContentViewInDirection:(EPanDirection)direction {
    // NSArray *tmparr = self.nowPlaydata[self.nowScreen];
    MJCollectionViewController *collecView = self.nowPlaydata[@"collec"];
    switch (direction) {
        case EPanDirectionRight:{
            //第一个跳到最后一个
            if(collecView.clickNum == 0){
                collecView.clickNum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count]-1;
                if(collecView.num == CLOSEPAGE){
                    if([self.nowPlaydata[StringFromInt(self.nowScreen)] count]%CLOSEPAGE >0){
                        collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - [self.nowPlaydata[StringFromInt(self.nowScreen)] count]%CLOSEPAGE;
                    }
                    else{
                        collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - CLOSEPAGE;
                    }
                    collecView.pageBtnnum = collecView.pagenum/CLOSEPAGE+1;
                    collecView.clickNum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count]-1;
                }
                else{
                    if([self.nowPlaydata[StringFromInt(self.nowScreen)] count]%OPENPAGE >0){
                        collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - [self.nowPlaydata[StringFromInt(self.nowScreen)] count]%OPENPAGE;
                    }
                    else{
                        collecView.pagenum = [self.nowPlaydata[StringFromInt(self.nowScreen)] count] - OPENPAGE;
                    }
                    collecView.pageBtnnum = collecView.pagenum/OPENPAGE+1;
                }
                [collecView.collectionView reloadData];
                if(![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"width"])] && ![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"height"])]){
                    [self.showImage setImage:[[DownloadImage sharedInstance] getUrlImage:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"templateId"]) Block:^(UIImage *image){
                        [self.showImage setImage:image];
                    }]];
                    
                    [[TimerDownImage sharedInstance] downCallBackData:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"templateId"]) CallBack:^(UIImage *image){
                        [self.showImage setImage:image];
                    }];
                }
                else{
                    [[TimerDownImage sharedInstance] stopTimerDownImage];
                    self.showImage.image = nil;
                 // Alert(@"图片height或width为空");
                }
                
                return;
            }
            if(collecView.clickNum > 0){
                if(![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum-1][@"width"])] && ![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum-1][@"height"])]){
                    [self.showImage setImage:[[DownloadImage sharedInstance] getUrlImage:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum-1][@"templateId"]) Block:^(UIImage *image){
                        [self.showImage setImage:image];
                    }]];
                    
                    [[TimerDownImage sharedInstance] downCallBackData:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum-1][@"templateId"]) CallBack:^(UIImage *image){
                        [self.showImage setImage:image];
                    }];
                }
                else{
                    [[TimerDownImage sharedInstance] stopTimerDownImage];
                    self.showImage.image = nil;
                    //Alert(@"图片height或width为空");
                }
                
                collecView.clickNum -=1;
                if(collecView.clickNum >1){
                    if(self.ocflag){
                        if((collecView.clickNum+1)%OPENPAGE== 0){
                            [self proBtnpage];
                        }
                    }
                    else{
                        if((collecView.clickNum+1)%CLOSEPAGE == 0){
                            [self proBtnpage];
                        }
                    }
                }
                [collecView.collectionView reloadData];
            }
            break;
        }
        case EPanDirectionLeft:{
            //最后一个跳到第一个
            if(collecView.clickNum == [self.nowPlaydata[StringFromInt(self.nowScreen)] count]-1){
                collecView.clickNum = 0;
                collecView.pagenum = 0;
                collecView.pageBtnnum = 1;
                [collecView.collectionView reloadData];
                if(![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"width"])] && ![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"height"])]){
                    [self.showImage setImage:[[DownloadImage sharedInstance] getUrlImage:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"templateId"]) Block:^(UIImage *image){
                        [self.showImage setImage:image];
                    }]];
                    
                    [[TimerDownImage sharedInstance] downCallBackData:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum][@"templateId"]) CallBack:^(UIImage *image){
                        [self.showImage setImage:image];
                    }];
                }
                else{
                    [[TimerDownImage sharedInstance] stopTimerDownImage];
                    self.showImage.image = nil;
                   //Alert(@"图片height或width为空");
                }
                return;
            }
            if(collecView.clickNum < [self.nowPlaydata[StringFromInt(self.nowScreen)] count]-1){
                
                if(![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum+1][@"width"])] && ![@"0" isEqualToString:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum+1][@"height"])]){
                    [self.showImage setImage:[[DownloadImage sharedInstance] getUrlImage:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum+1][@"templateId"]) Block:^(UIImage *image){
                        [self.showImage setImage:image];
                    }]];
                    
                    [[TimerDownImage sharedInstance] downCallBackData:StringFromId(self.nowPlaydata[StringFromInt(self.nowScreen)][collecView.clickNum+1][@"templateId"])CallBack:^(UIImage *image){
                        [self.showImage setImage:image];
                    }];
                }
                else{
                    [[TimerDownImage sharedInstance] stopTimerDownImage];
                    self.showImage.image = nil;
                   // Alert(@"图片height或width为空");
                }
                collecView.clickNum +=1;
                if(collecView.clickNum >1){
                    if(self.ocflag){
                        if((collecView.clickNum)%OPENPAGE== 0){
                            [self nextBtnpage];
                        }
                    }
                    else{
                        if((collecView.clickNum)%CLOSEPAGE == 0){
                            [self nextBtnpage];
                        }
                    }
                }
                [collecView.collectionView reloadData];
            }
            break;
        }
        default:
            break;
    }
    
}
-(void)eventScreenSendTcpTrue:(NSString *)hostId
{
    NSArray *arr = [hostId componentsSeparatedByString:@","];
    
    if([arr count]){
        for(NSString *host in arr){
            TcpClient *tcp = [TcpClient sharedInstance];
         //   dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                [tcp writeString:[Common hostidtostring:[host intValue] Metuod:@"SetMainNewProcesses"]];
          //  });
        }
    }
}
-(void)eventScreenSendTcpFalse:(NSMutableArray *)arr
{
    for(NSString *host in arr){
            TcpClient *tcp = [TcpClient sharedInstance];
        //dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        [tcp writeString:[Common  hostidtoFalsestring:[host intValue] Metuod:@"SetMainNewProcesses"]];
        //    });
        }
  //  }
}
-(void)proHostIDArrCatch:(NSString *)hostId
{
    self.proHostArr = [NSMutableArray arrayWithArray:[hostId componentsSeparatedByString:@","]];
}
-(BOOL)proHostIdIsEmpry:(NSString *)hostId
{
    BOOL isEqual = NO;
    NSArray *arr = [hostId componentsSeparatedByString:@","];
    for(NSString *host in self.proHostArr){
        for(NSString *hostpro in arr){
            if([host isEqualToString:hostpro]){
                isEqual = YES;
                break;
            }
        }
    }
    return isEqual;
}
@end
